package com.ekingstar.framework.action;

import java.util.LinkedHashMap;
import java.util.Map;

import org.apache.struts2.config.Action;

import com.opensymphony.xwork2.ActionSupport;
import com.ekingstar.framework.app.ApplicationParameter;
import com.ekingstar.framework.domain.SystemLog;
import com.ekingstar.framework.service.ISystemLogService;
import com.ekingstar.framework.util.Page;

/**
 * 
 * @author GQ
 *
 */
@Action(name="list",namespace="/syslog")
public class ListSystemLogAction extends ActionSupport{
	
	private Page page;
	private int pageNo = 1;
	private int pageSize = ApplicationParameter.INSTANCE.getPageSize();
	
	private ISystemLogService systemLogService;
	private SystemLog systemLog;
	private Map logtypes;
	
	public String execute(){
		//this.logtypes = this.systemLogService.getSystemLogTypeList();
		if (logtypes == null) logtypes = new LinkedHashMap();
		SystemLog.LogType[] tps = SystemLog.LogType.values();
		logtypes.put(null, "请选择");
		for (int i = 0; i< tps.length;i++){
			logtypes.put( tps[i].name(), tps[i].toString());
		}
		
		page = this.systemLogService.getSystemLogPage(systemLog, pageNo, pageSize);	
		return "list";
	}
	
	public ISystemLogService getSystemLogService() {
		return systemLogService;
	}
	public void setSystemLogService(ISystemLogService systemLogService) {
		this.systemLogService = systemLogService;
	}
	public SystemLog getSystemLog() {
		return systemLog;
	}
	public void setSystemLog(SystemLog systemLog) {
		this.systemLog = systemLog;
	}
	public Page getPage() {
		return page;
	}
	public void setPage(Page page) {
		this.page = page;
	}
	public int getPageNo() {
		return pageNo;
	}
	public void setPageNo(int pageNo) {
		this.pageNo = pageNo;
	}
	public int getPageSize() {
		return pageSize;
	}
	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public Map getLogtypes() {
		return logtypes;
	}

	public void setLogtypes(Map logtypes) {
		this.logtypes = logtypes;
	}

	
	
}
